Difference between Servlet and JSP ?
Servlet and JSP
1668
18-Jul-2018
Updated on 18-Jul-2018
Prakash nidhi Verma
18-Jul-2018Servlet :
servlet is a Java class which is used to extend the capabilities of servers that host by webs servers and applications accessed by means of a request-response model.they can respond to other types of requests too. HTTP-specific servlet classes are defined by Java Servlet technology.
- Servlet is a java code
- Writing code for servlet is
- harder than JSP as it is html in java
- Servlet plays a controller role in MVC approach
- Servlet is faster than JSP
- Servlet can accept all protocol requests.
- In Servlet, we can override the service() method
JSP :
A JSP is a text document which contains two types of text
- static data : HTML,XML,SVG and WML
- dynamic datain : JSP elements
- JSP is a html based code
- JSP is easy to code as it is java in html
- JSP is the view in MVC approach for showing output
- JSP only accept http requests
- In JSP we cannot override its service() method
- In JSP session management is automatically enabled
- just need to click the refresh button its fast